#!/bin/bash
#
#  Author: Alexxrhuang 
#  Data: 2019.06.27
#  TODO:
#       1. 将这个脚本移植到python的数据准备中


set -e -o pipefail

stage=0
FILL_NUM=6
data_set='Urban_Sound'   # SED_SMALL | BBC | Urban_Sound
audio_dir="/home/xiaorong/Data/${data_set}"
scp_dir=${audio_dir}/wav.scp

if [ $stage -le 0 ]; then
  find $audio_dir -iname '*.wav' | sort | uniq | python -c "\
import sys
from random import shuffle
utt_id = 0
random_lines = [line for line in sys.stdin]
shuffle(random_lines)
for line in random_lines:
  wav = line.strip()
  sys.stdout.write(str(utt_id).zfill($FILL_NUM) + ' ' + wav + '\n')
  utt_id += 1
" > $scp_dir
fi
